﻿using Modules.Project;
using PetaPoco;
using PmSoft;
using PmSoft.Caching;
using System.ComponentModel;

namespace Modules
{
    /// <summary>
    /// 项目保证金缴纳信息
    ///</summary>
    [TableName("project_guarantee_payment")]
    [Description("项目保证金缴纳信息")]
    [PrimaryKey("id", AutoIncrement = true)]
    [CacheSetting(true, PropertyNamesOfArea = "Status")]
    [Serializable]
    public class ProjectGuaranteePayment : IEntity
    {
        /// <summary>
        ///
        ///</summary>
        [Column("id")]
        public int Id { get; set; }

        /// <summary>
        /// 关联项目Id
        ///</summary>
        [Column("project_id")]
        public int ProjectId { get; set; }

        /// <summary>
        /// 关联保证金账户Id
        ///</summary>
        [Column("guarantee_account_id")]
        public int GuaranteeAccountId { get; set; }

        /// <summary>
        /// 保证金账户类型
        /// </summary>
        [Column("guarantee_account_type")]
        public 保证金类型 GuaranteeAccountType { get; set; }

        /// <summary>
        /// 缴纳主体名称
        /// </summary>
        [Column("payment_name")]
        public string? PaymentName { get; set; }

        /// <summary>
        /// 缴纳主体社会统一信用代码
        /// </summary>
        [Column("payment_code")]
        public string? PaymentCode { get; set; }

        /// <summary>
        /// 缴存类型（100：按预设比例缴存 101：免除保证金 102：减少保证金应交金额 103：缓缴保证金 104：增加保证金应缴金额）
        ///</summary>
        [Column("deposite_type")]
        public 缴存类型? DepositeType { get; set; }

        /// <summary>
        /// 应缴纳金额
        ///</summary>
        [Column("payable")]
        public decimal? Payable { get; set; }

        /// <summary>
        /// 已缴纳金额/担保金额/保单金额
        ///</summary>
        [Column("paid")]
        public decimal? Paid { get; set; }

        /// <summary>
        /// 差异化缴存金额（应缴纳金额和已缴纳金额的差值，取正值）
        ///</summary>
        [Column("difference")]
        public decimal? Difference { get; set; }

        /// <summary>
        /// 余额
        /// </summary>
        [Column("balance")]
        public decimal Balance { get; set; }

        /// <summary>
        /// 缴存起始日期/有效期起始起始日期
        ///</summary>
        [Column("start_date")]
        public DateTime? StartDate { get; set; }

        /// <summary>
        /// 有效期终止日期
        ///</summary>
        [Column("end_date")]
        public DateTime? EndDate { get; set; }

        /// <summary>
        /// 工程担保保函函号/保险单号
        ///</summary>
        [Column("guarantee_letter_no")]
        public string GuaranteeLetterNo { get; set; }

        /// <summary>
        /// 保证金状态（0：待核实 1：有效 2：失效 -1：审核不通过）
        ///</summary>
        [Column("status")]
        public 保证金状态 Status { get; set; }

        /// <summary>
        /// 审核意见
        /// </summary>
        [Column("check_reason")]
        public string? CheckReason { get; set; }

        /// <summary>
        /// 是否退还（0：否 1：是）
        ///</summary>
        [Column("has_return")]
        public bool HasReturn { get; set; }

        /// <summary>
        /// 创建人
        ///</summary>
        [Column("creator")]
        public string? Creator { get; set; }

        /// <summary>
        /// 创建时间
        ///</summary>
        [Column("create_time")]
        public DateTime? CreateTime { get; set; }

        #region IEntity 成员

        [Ignore]
        object IEntity.EntityId { get { return this.Id; } }

        #endregion IEntity 成员
    }
}